package com.mswork.mes.service.impl;

import java.util.List;

import com.mswork.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.mswork.mes.mapper.AuxiliaryMapper;
import com.mswork.mes.domain.Auxiliary;
import com.mswork.mes.service.IAuxiliaryService;

/**
 * 辅料库存Service业务层处理
 *
 * @author ruoyi
 * @date 2025-04-09
 */
@Service
public class AuxiliaryServiceImpl implements IAuxiliaryService {
    @Autowired
    private AuxiliaryMapper auxiliaryMapper;

    /**
     * 查询辅料库存
     *
     * @param id 辅料库存主键
     * @return 辅料库存
     */
    @Override
    public Auxiliary selectAuxiliaryById(Long id) {
        return auxiliaryMapper.selectAuxiliaryById(id);
    }

    /**
     * 查询辅料库存列表
     *
     * @param auxiliary 辅料库存
     * @return 辅料库存
     */
    @Override
    public List<Auxiliary> selectAuxiliaryList(Auxiliary auxiliary) {
        return auxiliaryMapper.selectAuxiliaryList(auxiliary);
    }

    @Override
    public List<Auxiliary> selectAuxiliaryByAuxiliaryType(Auxiliary auxiliary) {
        return auxiliaryMapper.selectAuxiliaryByAuxiliaryType(auxiliary);
    }

    /**
     * 新增辅料库存
     *
     * @param auxiliary 辅料库存
     * @return 结果
     */
    @Override
    public int insertAuxiliary(Auxiliary auxiliary) {
        return auxiliaryMapper.insertAuxiliary(auxiliary);
    }

    /**
     * 修改辅料库存
     *
     * @param auxiliary 辅料库存
     * @return 结果
     */
    @Override
    public int updateAuxiliary(Auxiliary auxiliary) {
        auxiliary.setUpdateTime(DateUtils.getNowDate());
        return auxiliaryMapper.updateAuxiliary(auxiliary);
    }

    /**
     * 批量删除辅料库存
     *
     * @param ids 需要删除的辅料库存主键
     * @return 结果
     */
    @Override
    public int deleteAuxiliaryByIds(Long[] ids) {
        return auxiliaryMapper.deleteAuxiliaryByIds(ids);
    }

    /**
     * 删除辅料库存信息
     *
     * @param id 辅料库存主键
     * @return 结果
     */
    @Override
    public int deleteAuxiliaryById(Long id) {
        return auxiliaryMapper.deleteAuxiliaryById(id);
    }
}
